﻿using System;
using System.Collections.Generic;
using FacebookWrapper.ObjectModel;

namespace Desktop_Facebook
{
	public enum eSerializerTypes 
    { 
        Messages, 
        Birthdays, 
        Events
    }

	public static class CSVSerializerFactory
	{
		public static AbstractCSVSerializer Create(eSerializerTypes i_SerializerType, object i_CollectionInitalizer)
		{
			AbstractCSVSerializer serializer = null;

			switch (i_SerializerType)
			{
				case eSerializerTypes.Messages:
					serializer = new CSVMessagesSerializer { MessagesToSave = i_CollectionInitalizer as List<Message> };
					break;
				case eSerializerTypes.Birthdays:
					serializer = new CSVBirthdaySerializer { BirthdaysToSave = i_CollectionInitalizer as Dictionary<string, CustomDate> };
					break;
				case eSerializerTypes.Events:
					serializer = new CSVEventSerializer { EventsToSave = i_CollectionInitalizer as List<Event> };
					break;
				default:
					throw new Exception("unsupported serializer type");
			}
			
			return serializer;			
		}
	}
}
